//Api通用管理
import requests from "./request";


// export const reqCategoryList = ()=>request({url:'/product/getBaseCategoryList',method:'get'})
//新发订单查询接口
export function reqOrderInitiate(params,query){
        return requests({
        url: '/order/getInitiateList',
        method: 'post',
        params: params,
        headers: {'Content-Type': 'application/json'},
        data: query
        })
}

//订单详情查询
export const reqQueryDetail = (orderId)=>requests({url:'/order/detailInfo/' + orderId,method:'get'})

//注册页面学校数据请求
export const reqSchoolList = ()=>requests({url:'/user/schools',method:'get'})

//注册页面校区数据请求
export const reqCampusList = (schoolId)=>requests({url:'/user/campus/' +schoolId,method:'get'})


//注册

export function reqRegister(userFrom) {
        return requests({
                url: '/user/register',
                method: 'post',
                headers: {'Content-Type': 'application/json'},
                data : userFrom
        })
}
export function reqUpdateUser(userFrom) {
        return requests({
                url: '/order/updateUser',
                method: 'post',
                headers: {'Content-Type': 'application/json'},
                data : userFrom
        })
}
export const reqLogin = (userFrom)=>requests({url:encodeURI(`user/oauth/token?client_id=ZbbWebApp&client_secret=ZbbWebApp&grant_type=password&username={"studentId":"${userFrom.studentId}","password":"${userFrom.password}"}`),method:'post',})

// 获取用户信息
export const reqUserInfo = ()=>requests({url: '/order/request/userInfo', method:'get'})

//获取标签信息
export const reqLabelList = ()=>requests({url: '/order/addOrder/labelList', method:'get'})

//上传图片
export const fileRequest = (url, data) => {
        return requests({
                method: "post",
                url: url,
                data: data,
        });
};

//发布订单
export const reqOrderInfo = (orderFrom)=>requests({url: '/order/addOrder/insertOrder', method:'post', headers: {'Content-Type': 'application/json'}, data:orderFrom})

//查看我的订单
export const reqMyOrderItems = (params)=>requests({url: '/order/getSnapshotList', method:'get',params:params})

//查看受助订单
export const reqMyHelpOrderItems = (params)=>requests({url: '/order/getHelpSnapshotList', method:'get',params:params})//查看受助订单
// 添加联系人用户
export const reqAddAssUser = (assUserId, orderDetailId, userId)=>requests({url: '/comm/associationUser/addAssUser', method:'get',params: {assUserId, orderDetailId, userId}})
//接收订单
export const reqPlaceOrder = (userId,initiateId,detailId)=>requests({url: '/order/placeOrder', method:'get',
        params: {
                userId,
                initiateId,
                detailId
        }})
export const reqUserInfoById = (userId)=>requests({url: `/user/userInfo1/${userId}`, method:'get'})
//更新订单状态
export const reqUpdateSnapshotOrder = (snapshotId,status)=>requests({url: '/order/updateSnapshotOrder', method:'get', params:{snapshotId,status}})
//获取订单快照消息
export const reqGetSnapshotInfo = (snapshotId)=>requests({url: `order/getSnapshotInfo/${snapshotId}`, method:'get'})
// 统计订单数量
export const reqOrderMunCount = ()=>requests({url: 'order/getOrderMunCount', method:'get'})

export const reqUpdateUserStatus = ()=>requests({url: 'order/updateUserStatus', method:'get'})
export const reqOrderDetail = (orderId)=>requests({url: `order/getOrderDetail/${orderId}`, method:'get'})

// 获取最新一条数据显示
export const getUserSnapshotOne = ()=>requests({url:'order/getUserSnapshotOne',method:'get'})

// 退出登录
export const reqlogOut = (userId)=>requests({url:`/order/hand/logout/${userId}`,method:'get'})
export const reqChart = ()=>requests({url:'/user/getChart',method:'get'})

export const reqEvaluate = (evaluationStatus,evaluatedUserId,commentUserId,orderSnapshotId,comment,grade)=>requests({
        url:'/user/reqEvaluate',
        method:'post',
        data:{
                evaluationStatus: evaluationStatus,
                userId: evaluatedUserId,
                commentUserId: commentUserId,
                orderSnapshotId: orderSnapshotId,
                comment: comment,
                grade: grade
        }})

export function reqInitiateListByHot(params){
        return requests({
                url: '/order/getInitiateListByHot',
                method: 'post',
                params: params,
        })
}
